/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.Q100;
import queenb.web.inteface.Q100Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class Q100Store extends Q100 implements Q100Inf {

    @Override
    public int updateQ100By(int pnFN100, int pnFC4501, int pnFC4502, int pnFC4503, int pnFC5001, int pnFC5002,
            int pnFC5003, String pvFC550, String pvQV101, String pvQV102, Date pdQD103,
            Date pdQD104, String pvQV105, String pvQV106, String pvQV107, String pvQV108,
            String pvQV109, int pnQN110, int pnQN111, int pnQN112, int pnQN113, String pvQV114,
            String pvQV115, String pvQV116,int pnFH000, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.UPDATE_Q100, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.INTEGER, pnFC4501),
                        new Param(OracleTypes.INTEGER, pnFC4502),
                        new Param(OracleTypes.INTEGER, pnFC4503),
                        new Param(OracleTypes.INTEGER, pnFC5001),
                        new Param(OracleTypes.INTEGER, pnFC5002),
                        new Param(OracleTypes.INTEGER, pnFC5003),
                        new Param(OracleTypes.CHAR, pvFC550),
                        new Param(OracleTypes.CHAR, pvQV101),
                        new Param(OracleTypes.CHAR, pvQV102),
                        new Param(OracleTypes.DATE, pdQD103),
                        new Param(OracleTypes.DATE, pdQD104),
                        new Param(OracleTypes.CHAR, pvQV105),
                        new Param(OracleTypes.CHAR, pvQV106),
                        new Param(OracleTypes.CHAR, pvQV107),
                        new Param(OracleTypes.CHAR, pvQV108),
                        new Param(OracleTypes.CHAR, pvQV109),
                        new Param(OracleTypes.INTEGER, pnQN110),
                        new Param(OracleTypes.INTEGER, pnQN111),
                        new Param(OracleTypes.INTEGER, pnQN112),
                        new Param(OracleTypes.INTEGER, pnQN113),
                        new Param(OracleTypes.CHAR, pvQV114),
                        new Param(OracleTypes.CHAR, pvQV115),
                        new Param(OracleTypes.CHAR, pvQV116),
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.CHAR, pvLOGIN),});
            Param[] p = dataStatement.getMapParam();
            return super.update(dataStatement, Q100.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public int checkLoginExist(String pnLogin) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.CHECK_LOGIN_EXIT, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.CHAR, pnLogin)
                    });
            return super.update(dataStatement, Q100.class);
        } catch (SQLException ex) {
            Logger.getLogger(EmployeeStore.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public int updateQ100ById(int pnFN100, String pvQV101, String pvQV102N, String pvQV102A, String pvLOGIN) {
        //UPDATEPASSWORD_Q100
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.UPDATEPASSWORD_Q100, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.CHAR, pvQV101),
                        new Param(OracleTypes.CHAR, pvQV102N),
                        new Param(OracleTypes.CHAR, pvQV102A),
                        new Param(OracleTypes.CHAR, pvLOGIN),});
            Param[] p = dataStatement.getMapParam();
            return super.update(dataStatement, Q100.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }

    @Override
    public int updateGoogleAccountById(int pnFN100,int pnFH000, String pvQV117, String pvQV118, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.UPDATEPASSWORDGOOGLE_Q100, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.CHAR, pvQV117),
                        new Param(OracleTypes.CHAR, pvQV118),                  
                        new Param(OracleTypes.CHAR, pvLOGIN),});
            Param[] p = dataStatement.getMapParam();
            return super.update(dataStatement, Q100.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }
    
    @Override
    public int updateGoogleAccountReceiveById(int pnFN100,int pnFH000,String pvQV119, String pvQV120, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.UPDATEPASSWORDRECEIVE_Q100, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.CHAR, pvQV119),
                        new Param(OracleTypes.CHAR, pvQV120),
                        new Param(OracleTypes.CHAR, pvLOGIN),});
            Param[] p = dataStatement.getMapParam();
            return super.update(dataStatement, Q100.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }
    
    @Override
    public int updateSignature(int pnFN100,int pnFH000,String pvQV121, String pvLOGIN){
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.UPDATESIGNATURE_Q100, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.CHAR, pvQV121),
                        new Param(OracleTypes.CHAR, pvLOGIN),});
            Param[] p = dataStatement.getMapParam();
            return super.update(dataStatement, Q100.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public List<Q100> getListTabQ100(int pn100, String pvLogin) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_Q100, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pn100),
                        new Param(OracleTypes.CHAR, pvLogin)
                    });
            return super.find(data, Q100.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int updateQ100ByPass(String pvSchema, String pvTabName, String pvColName,
            String pnValue, String pvPrimakey, int pnCondition, String pvLogin) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.UPDATEPASS_Q100, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.CHAR, pvSchema),
                        new Param(OracleTypes.CHAR, pvTabName),
                        new Param(OracleTypes.CHAR, pvColName),
                        new Param(OracleTypes.CHAR, pnValue),
                        new Param(OracleTypes.CHAR, pvPrimakey),
                        new Param(OracleTypes.INTEGER, pnCondition),
                        new Param(OracleTypes.CHAR, pvLogin),});
            return super.updateNoOutParam(dataStatement, Q100.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public List<Q100> getListCombQ100(int pnFH000,
            int pnFH200,
            int pnFN100,
            String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_COMBQ100, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, Q100.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(Q100Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
    @Override
    public int getIdByUserLogin(String pnLogin){
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.Q100_GET_ID_BY_USER, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.CHAR, pnLogin)
                    });
            return super.update(dataStatement, Q100.class);
        } catch (SQLException ex) {
            Logger.getLogger(EmployeeStore.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }
}
